//
//  NSString+Extend.h
//  RMMaterialRed
//
//  Created by XBWH on 2024/3/7.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (Extend)
///日期转换,将NSString类型转化为NSdate类型
+(NSDate*)rb_NSStringChangeDateFormat:(NSString*)dateFormat datestring:(NSString*)datestring;
///根据数字返回周几
+(NSString *)rb_NSStringReplaceWeekDay:(NSString *)num;
///将时间年月日转换成时间戳
+(NSString *)rb_timeStringIntoYearMonDayTimeStamp:(NSString *)time;
///将时间戳转换成时间
+(NSString *)rb_timeStampIntoTimeString:(NSString *)time;
///将时间转换成时间戳
+(NSString *)rb_timeStringIntoTimeStamp:(NSString *)time;
///获取当前时间
+(NSString *)rb_getCurrentTime;
#pragma mark - 时间
///x年x月x日
@property(copy,readonly,nonatomic)NSString *rb_formatNianYueRi;
///x年x月
@property(copy,readonly,nonatomic)NSString *rb_formatNianYue;
///x月x日
@property(copy,readonly,nonatomic)NSString *rb_formatYueRi;
/// x年
@property(copy,readonly,nonatomic)NSString *rb_formatNian;
///x时x分x秒
@property(copy,readonly,nonatomic)NSString *rb_formatShiFenMiao;
///x时x分
@property(copy,readonly,nonatomic)NSString *rb_formatShiFen;
///x分x秒
@property(copy,readonly,nonatomic)NSString *rb_formatFenMiao;
///yyyy-MM-dd
@property(copy,readonly,nonatomic)NSString *rb_format_yyyy_MM_dd;
///yyyy/MM/dd
@property(copy,readonly,nonatomic)NSString *rb_newFormat_yyyy_MM_dd;
///yyyy-MM
@property(copy,readonly,nonatomic)NSString *rb_format_yyyy_MM;
///MM-dd
@property(copy,readonly,nonatomic)NSString *rb_format_MM_dd;
///MM/dd
@property(copy,readonly,nonatomic)NSString *rb_newFormat_MM_dd;
///MM.dd
@property(copy,readonly,nonatomic)NSString *rb_newFormatMMdd;
///yyyy
@property(copy,readonly,nonatomic)NSString *rb_format_yyyy;
///HH:mm:ss
@property(copy,readonly,nonatomic)NSString *rb_format_HH_mm_ss;
///HH:mm
@property(copy,readonly,nonatomic)NSString *rb_format_HH_mm;
///mm:ss
@property(copy,readonly,nonatomic)NSString *rb_format_mm_ss;
///转换为星期几
@property(copy,readonly,nonatomic)NSString *rb_formatWeekDay;

///时间格式化1个小时以内：**分钟前发布
+(NSString *)rb_formatTimeDetailTimeStr:(NSString *)timeStr;
///比赛时间
+(NSString *)rb_timeFormatMonthAndDay:(NSString *)timeStr;
///时间格式化
+(NSString *)rb_timeStringYearMonthDayTimeFormat:(NSString *)timeStr;

#pragma mark 文字高度
/// 计算文字的大小,约束宽度
- (CGSize)rb_sizeWithFont:(UIFont *)font constrainedToWidth:(CGFloat)width;
/// 计算文字的大小,约束高度
- (CGSize)rb_sizeWithFont:(UIFont *)font constrainedToHeight:(CGFloat)height;
///获取文字高度
+ (CGFloat)rb_height:(NSString*)text width:(CGFloat)width space:(CGFloat)space font:(UIFont*)font;
///获取文字行数
+ (NSInteger)rb_lineNum:(NSString*)text width:(CGFloat)width space:(CGFloat)space font:(UIFont*)font;

#pragma mark 其他
///传给后台拼接后的字符
+(NSString *)rb_spliceStringWithArray:(NSMutableArray *)array;
///将字典或数组转换成字符串
+(NSString *)rb_objectToJson:(id)obj;
/// 若字符串为<null>，则返回一个空字符串，反正返回自身
-(NSString *)rb_editNullStr;
#pragma mark - 富文本
///添加图片
+(NSMutableAttributedString *)rb_insterImageWithAttributedString:(NSString *)content WithImageName:(NSString *)imageName WithCGRectMake:(CGRect)bounds WithIsInterTail:(BOOL)isIsInterTail;
///添加多张图片
+(NSMutableAttributedString *)rb_insterImageWithAttributedString:(NSString *)content WithImageNames:(NSArray *)imageNames WithImageBounds:(NSArray *)imageBounds;

#pragma mark 处理js标签
///清除html标签
-(NSString *)rb_stringByStrippingHTML;
///清除js脚本
-(NSString *)rb_stringByRemovingScriptsAndStrippingHTML;
///截取两个字符串中间的内容
-(NSString *)rb_stringSubstringWithStringStart:(NSString *)subStringStart WithStringEnd:(NSString *)subStringEnd;
@end

NS_ASSUME_NONNULL_END
